 package utils;

import java.io.File;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class StopWordList {
   
   Set<String> words;
   IStemmer stemmer;
   
   public StopWordList() {
      words = new HashSet<String>();
      stemmer = new Stemmer();
      
      final File sw = new File("data/LongStopWords");
      Scanner in = null;
      
      try {
         in = new Scanner(sw);
      }
      catch (final Exception e) {
         System.out.println("No Stop Words File Found");
      }
      
      while (in != null && in.hasNext()) {
         
         String tmp = in.next();
         
         tmp = stemmer.stemWord(tmp);
         
         words.add(tmp);
      }
   }
   
   public boolean isStopWord(final String word) {
      return words.contains(word);
   }
   
   public Set<String> getStopWordSet() {
      return words;
   }
}
